home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / bluebook.zip / MULTIDGT.DOC < prev    next >
Text File  |  1986-05-11  |  5KB  |  105 lines

  1. MULTIDGT.DOC -- Multidigit Arithmetic Procedures
  2. ================================================
  3.  
  4.   From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT'
  5.         by Christopher L. Morgan
  6.         Copyright (C) 1984 by The Waite Group, Inc.
  7.  
  8.    Purpose: These routines perform addition, subtraction, multiplication, 
  9.      and division upon multidigit integers (16-bit).
  10.  
  11.    Contents:
  12.    ---------
  13.    MBINADD --  Multidigit binary addition
  14.    MBINDIV --  Multidigit binary division
  15.    MBINMUL --  Multidigit binary multiplication
  16.    MBINSUB --  Multidigit binary subtraction
  17.  
  18.   Overview: These routines use 16-bit integers as `digits', but could easily
  19.     be modified to use 8-bit integers, instead. Many operations are performed
  20.     using 8- or 16-bit arithmetic operations on the individual `digits'. The
  21.     exception here is the division routine, which uses binary arithmetic.
  22.  
  23.  ____________________________ MULTIDIGIT ROUTINES ____________________________
  24.           
  25. Routine to perform multidigit binary addition.
  26.  
  27.   Function: This routine adds two multidigit binary numbers.
  28.  
  29.   Input: Upon entry, DS:SI points to the first number, DS:DI points to the
  30.     second number, and DS:BX points to the location where the result will be
  31.     stored. The size of thes multidigit numbers is controlled by the constant,
  32.     ISIZE. All three numbers contain 16 * ISIZE number of bits and are stored
  33.     in ISIZE number of 16-bit words in memory.
  34.  
  35.   Output: Upon exit, DS:BX points to where the result is stored.
  36.  
  37.   Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
  38.  
  39.   Segments referenced: Upon entry, the data segment must contain the constant,
  40.     ISIZE and storage for three multidigit numbers, two for input and one for
  41.     output.
  42. ______________________________________________________________________________
  43.  
  44. Routine to perform multidigit binary division.
  45.  
  46.   Function: This routine divides two multidigit binary numbers, returning
  47.     both a quotient and a remainder.
  48.  
  49.   Input: Upon entry, DS:SI points to the divisor, DS:BX points to where the
  50.     dividend is upon entry and where the remainder will be upon exit, and
  51.     DS:DI points to the location where the quotient will be upon exit. The
  52.     size of thes multidigit numbers is controlled by the constant,ISIZE.
  53.     The divisor and quotient contain 16 * ISIZE number of bits and the dividend
  54.     and remainder have double that precision.  Both the divisor and quotient
  55.     are stored in ISIZE number of 16-bit words in memory, and the dividend 
  56.     and remainder are stored in 2 * ISIZE number of 16-bit words of memory.
  57.  
  58.   Output: Upon exit, DS:BX points to where the quotient is stored and
  59.     DS:DI points to where the remainder is stored.
  60.  
  61.   Registers used: Unmodified; SI, DI, & CX are saved & restored.
  62.  
  63.   Segments referenced: Upon entry, the data segment must contain the constant,
  64.     ISIZE and storage for the multidigit numbers described above.
  65. ______________________________________________________________________________
  66.  
  67. Routine to perform multidigit binary multiplicaton.
  68.  
  69.   Function: This routine multiplies two multidigit binary numbers.
  70.  
  71.   Input: Upon entry, DS:SI points to the first number, DS:DI points to the
  72.     second number, and DS:BX points to the location where the result will be
  73.     stored. The size of thes multidigit numbers is controlled by the constant,
  74.     ISIZE. All three numbers contain 16 * ISIZE number of bits and are stored
  75.     in ISIZE number of 16-bit words in memory.
  76.  
  77.   Output: Upon exit, DS:BX points to where the result is stored.
  78.  
  79.   Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
  80.  
  81.   Segments referenced: Upon entry, the data segment must contain the constant,
  82.     ISIZE and storage for three multidigit numbers, two for input and one for
  83.     output.
  84. ______________________________________________________________________________
  85.  
  86. Routine to perform multidigit binary subtraction. 
  87.  
  88.   Function: This routine subtracts two multidigit binary numbers.
  89.  
  90.   Input: Upon entry, DS:SI points to the first number, DS:DI points to the
  91.     second number, and DS:BX points to the location where the result will be
  92.     stored. The size of thes multidigit numbers is controlled by the constant,
  93.     ISIZE. All three numbers contain 16 * ISIZE number of bits and are stored
  94.     in ISIZE number of 16-bit words in memory.
  95.  
  96.   Output: Upon exit, DS:BX points to where the result is stored.
  97.  
  98.   Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
  99.  
  100.   Segments referenced: Upon entry, the data segment must contain the constant,
  101.     ISIZE and storage for three multidigit numbers, two for input and one for
  102.     output.
  103. ______________________________________________________________________________
  104. >>>>> Physical EOF MULTIDGT.DOC <<<<<
  105.